//
//  AuthodExpresserCell.m
//  TengyunStation
//
//  Created by Johnny on 15/10/22.
//  Copyright © 2015年 xingrong. All rights reserved.
//

#import "AuthodExpresserCell.h"
#import "TSHeader.h"
#import "ExpresserDBModel.h"
#import "UIImageView+WebCache.h"

@implementation AuthodExpresserCell

- (void)awakeFromNib {
    // Initialization code
    UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, 79.5, 320, 0.5)];
    line.backgroundColor = LineColor;
    [self addSubview:line];
    _logoImageView.layer.cornerRadius = 4;
    _logoImageView.clipsToBounds = YES;
    _moneyFlagLabel.layer.cornerRadius = 8;
    _moneyFlagLabel.clipsToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)reloadAuthodExpresserCell:(ExpresserDBModel *)expresser {
    NSString *companyUrl = [expresser.expressCompanyLogo stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
    NSURL *logoUrl = [NSURL URLWithString:companyUrl];
    [_logoImageView sd_setImageWithURL:logoUrl placeholderImage:[UIImage imageNamed:@"yijskd_logo_bg"]];
    _expressCompanyLabel.text = expresser.expressCompanyName;
    _nameLabel.text = [NSString stringWithFormat:@"%@  %@",expresser.expresserName,expresser.telephone];
    _timeLabel.text = [NSString stringWithFormat:@"生效时间:%@",expresser.efficientTime];
    if (expresser.money >= 0) {
        _moneyFlagLabel.backgroundColor = UIColorFromRGB(0x96c800);
        _moneyFlagLabel.text = @"正常";
    } else {
        _moneyFlagLabel.backgroundColor = OrangeColor;
        _moneyFlagLabel.text = @"欠费";
    }
}

@end
